from building import *

cwd = GetCurrentDir()
src = ['spi_core.c', 'spi_dev.c']
CPPPATH = [cwd, cwd + '/../include']

src_device = []

if GetDepend('RT_USING_SPI_WIFI'):
    src_device += ['spi_wifi_rw009.c']

if GetDepend('RT_USING_W25QXX'):
    src_device += ['spi_flash_w25qxx.c']
    
if GetDepend('RT_USING_W25QXX_MTD'):
    src_device += ['spi_flash_w25qxx_mtd.c']    
    
if GetDepend('RT_USING_ENC28J60'):
    src_device += ['enc28j60.c']

if GetDepend('RT_USING_AT45DBXX'):
    src_device += ['spi_flash_at45dbxx.c']

if GetDepend('RT_USING_SST25VFXX'):
    src_device += ['spi_flash_sst25vfxx.c']

if GetDepend('RT_USING_GD'):
    src_device += ['spi_flash_gd.c']
    
if GetDepend('RT_USING_SFUD'):
    src_device += ['spi_flash_sfud.c', 'sfud/src/sfud.c']
    CPPPATH += [cwd + '/sfud/inc']
    if GetDepend('RT_SFUD_USING_SFDP'):
        src_device += ['sfud/src/sfud_sfdp.c']

src += src_device

group = DefineGroup('DeviceDrivers', src, depend = ['RT_USING_SPI'], CPPPATH = CPPPATH)

Return('group')
